<html>
<head>
    <title>CRM MTP</title>
    <base href="<?=base_url() ?>"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="icon" href="resources/icons/fam/icons/telephone.png" type="image/x-icon">

    <script type="text/javascript" src="resources/js/libraries/jquery-1.4.2.min.js"></script>

    <!--incarca css-uri-->
    <link rel="stylesheet" type="text/css" href="resources/ext33/resources/css/ext-all.css"/>
    <link rel="stylesheet" type="text/css" href="provider/componentCss/<?=time()?>.css"/>
    <link rel="stylesheet" type="text/css" href="resources/icons/fam/css/fam-pack.css"/>
    <link rel="stylesheet" type="text/css" href="resources/icons/fugue/css/fugue-pack.css"/>

    <!--incarca css-ul template al fiecarui user peste css de baza ext-->
    <!--<link href="resources/ext33/resources/css/<?=$user['template_style']?>" rel="stylesheet" type="text/css" id="theme">-->

    <!--incarca EXTJS -->
    <script type="text/javascript" src="resources/ext33/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="resources/ext33/ext-all.js"></script>
    <script src="resources/ext33/src/locale/ext-lang-ro.js"></script>

    <!-- incarca extensii -->
    <script type="text/javascript" src="provider/extensions/<?=time()?>.js"></script>

</head>
<body>


<script type="text/javascript">
    //incarca imagine necesara pentru a simula transparenta in IE6
    Ext.BLANK_IMAGE_URL = '././resources/img/s.gif';
    Ext.ns('Portal');
    Ext.ns('Portal.object');
    Ext.QuickTips.init();

    //adaugare in namespace-ul Portal a datelor despre user si
    Ext.apply(Portal, {
        today: '<?=date('Y-m-d')?>',
        user_id:'<?=$user['user_id']?>',
        user_name:'<?=$user['name']?>',
        user_role:'<?=$user['level']?>'
    });


    //aducere a datelor de pe server in browser si a retinerii lor in cache.. aceste date vor fi necesare pentru store-ul unor comboboxuri in ideea de a nu solicita serverul
    //deoarece datele (judetele, pozitiile, clientii) se modifica in afara programului de catre un administrator nu e necesara implementarea unui mecanism de aducere in permanenta a datelor in browser , retinerea lor in cache fiind suficienta
    //functia dataView are ca rol extragerea unei valori ; datele in fiecare obiect vin sub forma [a1,a2][b1,b2].. functia dataView primeste ca paramentru x1 si extrage valoarea x2 unde x poate fi a,b,...
    Ext.apply(Portal.object, {
        city : Ext.util.JSON.decode(<?=json_encode($extCity)?>),
        county : Ext.util.JSON.decode(<?=json_encode($extCounty)?>),
        domain : Ext.util.JSON.decode(<?=json_encode($extDomain)?>),
        subdomain : Ext.util.JSON.decode(<?=json_encode($extSubDomain)?>),
        position: Ext.util.JSON.decode(<?=json_encode($extPosition)?>),
        subposition: Ext.util.JSON.decode(<?=json_encode($extSubPosition)?>),
        client : Ext.util.JSON.decode(<?=json_encode($extClient)?>),
        user : Ext.util.JSON.decode(<?=json_encode($extUser)?>),
        division : Ext.util.JSON.decode(<?=json_encode($extDivision)?>),
        letter : Ext.util.JSON.decode(<?=json_encode($extLetters)?>),
        age:Ext.util.JSON.decode(<?=json_encode($extAge)?>),
        income :Ext.util.JSON.decode(<?=json_encode($extIncome)?>),
        employee:Ext.util.JSON.decode(<?=json_encode($extEmployee)?>),
        available:Ext.util.JSON.decode(<?=json_encode($extAvailable)?>),
        unsubscribed:Ext.util.JSON.decode(<?=json_encode($extUnsubscribed)?>),
        priority:Ext.util.JSON.decode(<?=json_encode($extPriority)?>),
        sex : Ext.util.JSON.decode(<?=json_encode($extSex)?>) ,
        dataView : function(data, id) {
            for (var i in data)
                if (data[i][0] == id)
                    return data[i][1];
        }
    });

</script>

<script type="text/javascript" src="resources/js/aplicationframe.js?<?=time()?>"></script>
<script type="text/javascript" src="provider/allowed_components/<?=time()?>.js"></script>

<script>
    //se incarca si executa functia de creare  regiuni ( vezi aplicationFrame.js )
    Ext.onReady(Portal.main.exec, Portal.main);
    //se incarca si executa functia de creare meniuri ( vezi aplicationFrame.js )
    Ext.onReady(Portal.main.fnAddMenuObjects, Portal.main);
    //se incarca si executa functia de creare a administrarii contactelor ( vezi aplicationFrame.js )
    //Ext.onReady(Portal.campaignScreen.exec);
    //Ext.onReady(Portal.teleScreen.exec);
    Ext.onReady(Portal.bazaScreen.exec, Portal.main);
    //Ext.onReady(Portal.teleScreen.exec, Portal.teleScreen);
    //Ext.onReady(Portal.main.fnOpenCorrectorScreen, Portal.main);
    //Ext.onReady(Portal.main.fnOpenImportClientScreen, Portal.main);
</script>
</body>
</html>
